import ErrorHandlerContext from "../contexts/errorHandlerContext";

let setError = () => {};

const ErrorHandlerProvider = ({ callback, children }) => {
  if (callback) {
    setError = callback;
  }

  return (
    <ErrorHandlerContext.Provider value={setError}>
      {children}
    </ErrorHandlerContext.Provider>
  );
};

export default ErrorHandlerProvider;
